<?php
require_once 'includes/config.php';
//require_once 'includes/functions.php';

$id = $_POST['id'];

$table="
<div style='float:left; width:95%; text-align:right; font-weight:bold; padding:5px;'>
<a href='javascript:void(0)' onclick='$(\"#catBox\").hide();'>x</a>
</div>
<table width='100%' border='0'>";

$table.="<tr>";

$table.="<td width=100 valign=top>";
$sqlCatForSale="Select category_id,category_name FROM tbl_category where parent_id=$id ORDER BY category_name ASC";
$rstCatForSale=mysql_query($sqlCatForSale);				 
$numCatForSale=mysql_num_rows($rstCatForSale);
if($numCatForSale==0)
{
        $table.="No Categories Found...";
}
else{
$i=1;
$j=0;
 while($rowCatForSale=mysql_fetch_array($rstCatForSale))
 {
 if($i!=0)
 {
        $table.="<a href='index.php?subCat=".$rowCatForSale["category_id"]."' style='margin:4px 0px 4px 0px; float:left; color:#000000; width:100%;'>".$rowCatForSale["category_name"]."</a><br>";
        $j++;
         if($j%10==0)
          $table.="</td ><td width=100 valign=top>";
         if($j>=250)
           $i=0;
 }
 else
    $table.="More Items";
 }
 }
$table.="</td>";
$table.="</tr>";
 $table.="</table>";
 
 echo $table;
?>